﻿namespace BrainTechLLC
{
	using System;
	using System.Collections.Generic;
	using System.Linq;
	using System.Text;

	//public class Test
	//{
	//    #region Methods

	//    public static void PerformTest()
	//    {
	//        if (!WorldMap.Instance.Restore<WorldMap>(null, out WorldMap.Instance))
	//        {
	//            WorldMap.Instance.CreateTestWorld();
	//        }

	//        ChangeDelegate ChangeName2 = new ChangeDelegate((o, args, signals) =>
	//        {
	//            GameChar theChar = o as GameChar;
	//            theChar.Name.Name = args[0] as string;
	//        });

	//        ChangeDelegate ChangeName = new ChangeDelegate((o, args, signals) =>
	//        {
	//            GameChar theChar = o as GameChar;
	//            if (theChar.Name.Name != "TestChanged")
	//            {
	//                theChar.Name.Name = args[0] as string;
	//                GameChar otherChar = args[1] as GameChar;
	//                SingleChange nameChange = new SingleChange() { ChangeToApply = ChangeName2, Arguments = new List<object>() { "AnotherName" } };
	//                ChangeAndCheck changeName = new ChangeAndCheck() { Change = nameChange };
	//                otherChar.RegisterChangeOrAction(changeName);
	//            }
	//        });

	//        List<IGameThing> chars = WorldMap.Instance.FindAllThingsOfType(typeof(GameChar));
	//        GameChar chr1 = chars[0] as GameChar;
	//        GameChar chr2 = chars[1] as GameChar;

	//        //GameChar chr1 = new GameChar() { Name = "Test", AssociatedID = 1, Location = new LocationInt(1, 1, 1) };
	//        //GameChar chr2 = new GameChar() { Name = "Test2", AssociatedID = 2, Location = new LocationInt(1, 1, 1) };
	//        SingleChange c = new SingleChange() { Arguments = new List<object>() { "TestChanged", chr2 }, ChangeToApply = ChangeName };
	//        ChangeAndCheck chg = new ChangeAndCheck() { Change = c };
	//        chr1.RegisterChangeOrAction(chg);

	//        chr1.ChangesAndActions.PerformChanges(chr1);
	//        chr2.ChangesAndActions.PerformChanges(chr2);
	//        chr1.Name.Name = "Char1";
	//        chr2.Name.Name = "Char2";
	//        Console.WriteLine(chr1.Name);
	//        Console.WriteLine(chr2.Name);

	//            //SomeNotification n = new SomeNotification() { NotificationTo = chr1, Notification = TestStuff.CreateStringNotification("testing") };
	//            //chr1.AddNotification(n);
	//            //chr1.Notifications.PerformNotifications(TestStuff.CreateAudience());

	//        WorldMap.Instance.Save(null);
	//    }

	//    #endregion Methods
	//}

	public static class TestStuff
	{		
		public static GameChar GameChar1
		{
			get { return Everything.Find<GameChar>(WorldMap.Instance.AllGameThingsInWorld[0]); }
		}

		public static GameChar GameChar2
		{
			get { return Everything.Find<GameChar>(WorldMap.Instance.AllGameThingsInWorld[1]); }
		}

        [MethodVisible]
		public static bool CheckCanSeeTest(long eventSource, object eventWatcher)
		{
			return true;
		}

        [MethodVisible]
		public static bool CheckSendTestNotification(object o, SingleModification change, Signals signals)
		{
			GameChar chr = o as GameChar;
			return (chr != null);
		}
	}
}
